//
//  JSMyGoods2View.swift
//  fho
//
//  Created by 郭颢源 on 2021/4/21.
//

import UIKit

class JSMyGoods2View: UIView {
    
    private lazy var cellId = "cellId"
    fileprivate lazy var tableView : UITableView = {
        let tv = UITableView(frame: CGRect.zero, style: .plain)
        tv.register(UITableViewCell.self, forCellReuseIdentifier: cellId)//注册cell
        tv.translatesAutoresizingMaskIntoConstraints = false// VFL
        //        tv.showsVerticalScrollIndicator = false//垂直滚动指示器
        tv.delegate = self
        tv.dataSource = self
        
        tv.separatorStyle = .none//分割线
        tv.estimatedRowHeight = 150//预设行高
        tv.backgroundColor = UIColor.white
        if #available(iOS 11.0, *) {
            tv.contentInsetAdjustmentBehavior = UIScrollView.ContentInsetAdjustmentBehavior.never
        }
        return tv
    }()
    let vm = BiGoodsViewModel()
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        addSubview(self.tableView)
        self.tableView.snp.makeConstraints { (make) in
            make.edges.equalToSuperview()
        }
        vm.getList()
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
}
extension JSMyGoods2View:UITableViewDelegate,UITableViewDataSource{
    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        1
    }
    
    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        let cell = tableView.dequeueReusableCell(for: JSMyGoodsCell.self)
        return cell
    }
    
}
